﻿// JScript 文件
$(document).ready(function(){
     
     //绑定标签栏
     var state = getParameter("state");
     var $tabs = $('#tabs').tabs();
     if ( state == 0 ){sel=1}else{sel=0}
     $tabs.tabs('select', sel);
     

     
 });
 
 //查看详细
 function OpenDetail(Qnid){
     $('#Form_Detail').dialog({
           autoOpen: false,
           width:775,
	       height:495,    
	       modal:true,
	       resizable:false,
	       closeOnEscape:true
    });
    $("#Form_Detail").dialog("open");  
    GetDetail(Qnid);   
 }
 
 //获得问卷

 function GetDetail(qnid)
 {
    $.ajax({
    type:"GET",
    url:"Comsrv/Comsrv.aspx",
    dataType:"json",
    data:"oper=GetQuestionnaire&qnid="+qnid,
    success:function(data){
     ArrayForm = data[0].Questions;
     if ( ArrayForm.length>0 )
     {
         $("#Form_Detail").empty();
         var html ="";
         for (var i=0;i<ArrayForm.length;i++)
         {
             html+="<ul>"+ArrayForm[i].ORDERIDX+"."+ArrayForm[i].QUESTION1+"</ul><ul>";
             switch ( ArrayForm[i].TYPE )
             {
                 case "single":
                     html+=FormatSingle(ArrayForm[i]);
                 break;
                 
                 case "single_other":
                     html+=FormatSingleOther(ArrayForm[i]);
                 break;
                 
                 case "multicheck":
                     html+=FormatMulticheck(ArrayForm[i]);
                 break;
                 
                 case "multicheck_other":
                     html+=FormatMulticheckOther(ArrayForm[i]);
                 break;
                 
                 case "singleblank":
                     html+=FormatSingleBlank(ArrayForm[i]);
                 break;
             }
             html+="</ul>";
             
         }
         $("#Form_Detail").html(html);
     }
    }
    });
 }
 
 



